package com.apes.hr.base.repository;

import com.apes.framework.jpa.repository.CustomRepository;
import com.apes.hr.base.model.SkillType;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * @author HuJianLin
 * @create 2018-04-28 16:07
 */
public interface SkillTypeRepository extends CustomRepository<SkillType, String>{
    @Query("SELECT T FROM SkillType T WHERE 1 = 1 and (id = :id or name like %:value%) ")
    Page<SkillType> find(@Param("id") String id, @Param("value") String value, Pageable pageable);

    @Query("SELECT T FROM SkillType T WHERE 1 = 1 and (name like %:value%) ")
    List<SkillType> findByName(@Param("value") String value);

    Page<SkillType> findByValidIsTrue(Pageable pageable);
}
